package com.bupt.liutong.admin.sch.dao;

import java.util.List;

import com.bupt.liutong.admin.core.base.Ibatis;
import com.bupt.liutong.admin.sch.dto.Album;

public class AlbumDao {

	private Ibatis ibatis;

	@SuppressWarnings("unchecked")
	public List<Album> getAlbumsByPage(Album album) {
		return (List<Album>) ibatis.queryForPage("sch_album.getAlbums", album);
	}

	public Album getAlbumById(Integer id) {
		return (Album) ibatis.queryForObject("sch_album.getAlbumById", id);
	}

	public void insertAlbum(Album album) {
		ibatis.insert("sch_album.insertAlbum", album);
	}

	public void updateAlbum(Album album) {
		ibatis.update("sch_album.updateAlbum", album);
	}

	public void updateAlbumCover(Album album) {
		ibatis.update("sch_album.updateAlbumCover", album);
	}

	public void deleteAlbum(Integer id) {
		ibatis.delete("sch_album.deleteAlbum", id);
	}

	public void setIbatis(Ibatis ibatis) {
		this.ibatis = ibatis;
	}
}
